package dcedit.util;

// Import Java JDK Classes
import javax.swing.tree.*;

/** JavaDocStyleRuleNode class */
public class JavaDocStyleRuleNode extends DefaultMutableTreeNode {
   /** Serial Version UID version for serializable classes */
   public static final long serialVersionUID = 1303853986666L;

   /** Style rule name (CSS notation) field */
   private String styleRuleName;

   /** Style rule prefix (CSS notation) field */
   private String styleRulePrefix;

   /** Style rule definition (CSS notation) field */
   private String styleRuleDefinition;

   /** Constructor */
   public JavaDocStyleRuleNode() {
      super();
   } // END constructor

   /** Constructor */
   public JavaDocStyleRuleNode(String styleRuleName) {
      this(styleRuleName,"");
   } // END constructor

   /** Constructor */
   public JavaDocStyleRuleNode(String styleRuleName, String styleRuleDefinition) {
      super(styleRuleName);
      this.styleRuleName = styleRuleName;
      this.styleRuleDefinition = styleRuleDefinition;
   } // END constructor

   /** getStyleRuleName method */
   public String getStyleRuleName() {
      return this.styleRuleName;
   } // END getStyleRuleName

   /** setStyleRuleName method */
   public void setStyleRuleName(String styleRuleName) {
      this.styleRuleName = styleRuleName;
   } // END setStyleRuleName

   /** getStyleRulePrefix method */
   public String getStyleRulePrefix() {
      return this.styleRulePrefix;
   } // END getStyleRulePrefix

   /** setStyleRulePrefix method */
   public void setStyleRulePrefix(String styleRulePrefix) {
      this.styleRulePrefix = styleRulePrefix;
   } // END setStyleRulePrefix

   /** getStyleRuleDefinition method */
   public String getStyleRuleDefinition() {
      return this.styleRuleDefinition;
   } // END getStyleRuleDefinition

   /** setStyleRuleDefinition method */
   public void setStyleRuleDefinition(String styleRuleDefinition) {
      this.styleRuleDefinition = styleRuleDefinition;
   } // END setStyleRuleDefinition

   /** addToStyleRuleDefinition method */
   public void addToStyleRuleDefinition(String styleRuleDefinitionAddend) {
      if(!this.styleRuleDefinition.isEmpty()) this.styleRuleDefinition += System.getProperty(Constants.LINE_SEPARATOR_PROPERTY);
      this.styleRuleDefinition += styleRuleDefinitionAddend;
   } // END addToStyleRuleDefinition

   /** method getStyleNameAndDefinition method */
   public String getStyleNameAndDefinition() {
      return (null != this.styleRulePrefix ? this.styleRulePrefix + " " : "") +
             this.styleRuleName + " {" + System.getProperty(Constants.LINE_SEPARATOR_PROPERTY) +
             this.styleRuleDefinition + System.getProperty(Constants.LINE_SEPARATOR_PROPERTY) +
             "}" + System.getProperty(Constants.LINE_SEPARATOR_PROPERTY);
   } // END getStyleNameAndDefinition
} // END class JavaDocStyleRuleNode
